Having Fun with Point Free Programming in APL

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.ค. 2024
  • In this video I solve the Perl Weekly Challenge from Week 134 and explore point free solutions in APL.
    PWC 134: theweeklychallenge.org/blog/p...
    Dyalog APL: www.dyalog.com/
    Dyalog RIDE: github.com/Dyalog/ride
    Chapters:
    0:00 Intro
    0:25 Task 1 Explanation
    0:45 Pandigital Numbers Wikipedia
    1:52 Pandigital Solution 1: github.com/manwar/perlweeklyc...
    8:08 Pandigital Solution 2: github.com/manwar/perlweeklyc...
    11:18 Pandigital Solution 3: github.com/manwar/perlweeklyc...
    15:47 Task 2 Explanation
    16:19 Distinct Term Count Solution: github.com/manwar/perlweeklyc...
    20:07 Outro
    Follow me on Github: github.com/codereport
    Follow me on Twitter: / code_report
    Follow me on LinkedIn: / codereport
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 35

  • @ricardo.mazeto
    @ricardo.mazeto 2 ปีที่แล้ว +58

    I just found your channel yesterday and I'm loving it, because you're one of the few programmers who deal with the interesting stuff, and not industry leading and boring technologies. Keep up the good work my dude. And thank you!

    • @lakshyarajsinghrathore1902
      @lakshyarajsinghrathore1902 2 ปีที่แล้ว +7

      that's exactly true, I feel the real joy of computer science after watching this channel's videos

    • @wintc
      @wintc 8 หลายเดือนก่อน +2

      >industry leading
      i.e. a load of OOP crap using a Java library? Lol

    • @ricardo.mazeto
      @ricardo.mazeto 8 หลายเดือนก่อน

      @@wintc Exactly. Haha.

  • @arraymac227
    @arraymac227 2 ปีที่แล้ว +4

    'God, you gotta love APL' or the equivalent laughing outburst, is a weekly occurrence, IME, ever since the 80s.

  • @GiriPrasath.D
    @GiriPrasath.D 3 หลายเดือนก่อน

    From your videos, only i start to know This programming languages, started to learn it, solving problems in apl.

  • @tangentstorm
    @tangentstorm 2 ปีที่แล้ว +7

    j translation for the second part is ~.@,@(*/&(>:@i.)) ..
    Thanks for doing these. As someone who understands the ideas from j but not the symbols (yet), it's kinda like watching a foreign movie with the subtitles turned on. :D

  • @ckafi1011
    @ckafi1011 2 ปีที่แล้ว +10

    In your first solution, why do you build a list just to reduce it? Why not swap the , out for + ?

  • @MrRyanroberson1
    @MrRyanroberson1 2 ปีที่แล้ว +3

    interestingly: it does work for 1. the pandigital expression in proper base 1 is 0, since the only allowed digits in a proper positional system are strictly less than b (for base 1 that means just 0). A nonzero notation version of the bases would include b as a digit but not 0, so the least pandigital numbers would be trivially 123...b, which is an entirely different expression.

  • @tangentstorm
    @tangentstorm 2 ปีที่แล้ว +7

    My attempt at a J version (of the first task): (#. 1 A.&.|. i.) each 2+i.10
    (A.) is an anagram index, and (1 A. y) swaps the two last items in y.
    (We want to swap the first two, so do it "under reverse").
    Then J's monadic hook copies the input to the left side, so the explicit version is (n #. 1 A.&.|. i.n).

    • @tikkanz9212
      @tikkanz9212 2 ปีที่แล้ว +1

      Nice! To build on this to get the solution that I think the original problem statement wanted:
      (#. i.@5: A. 1 A.&.|. i.) 10

  • @crazychicken0378
    @crazychicken0378 2 ปีที่แล้ว +3

    I don’t do apl but I love me some point free programming

  • @denispoisson6839
    @denispoisson6839 2 ปีที่แล้ว

    A smart solution to the pan numbers is simply to reverse the first two numbers of the iota of the base and decode. 1 0 2 is 11 in base 3, 1 0 2 3 is 75 in base 4, etc.

  • @bzboii
    @bzboii ปีที่แล้ว

    15:00 I think you can use the power operator to run a function until it "stabilizes" which maybe you could define as not being 0?

  • @purnojyotibhattacharjee7060
    @purnojyotibhattacharjee7060 2 ปีที่แล้ว

    Yo, VsCaide has updated, can u do an another video on it.

  • @ummaycoc
    @ummaycoc 2 ปีที่แล้ว +2

    Since (b - 1) = -(1 - b) we get (b - 1)^2 = (-1)^2(1 - b)^2 = (1 - b)^2 and you don't need that one commute in the first solution.

  • @pomo1238
    @pomo1238 ปีที่แล้ว

    Did you need the commute operator in the first part? Since (a-1)^2=(1-a)^2

  • @pmcgee003
    @pmcgee003 2 ปีที่แล้ว

    I guess it basically would recreate the formula, but how about create a list [ 1, 0, 2, 3, ... , n ] and a list [ n .. 0 ] and exp map and sum them to turn the base n into dec.

    • @rorykemp5218
      @rorykemp5218 2 ปีที่แล้ว +1

      APL actually has a primitive for base decoding/encoding, so a much shorter solution is available using that method. I would post it here but it seems YT censors comments with APL or links, so check his twitter instead if you're interested :)

  • @hotlinkster123
    @hotlinkster123 2 ปีที่แล้ว +12

    Cool, never seen point free programming before. However, I think you misinterpreted task 1 as it asks for the first 5 pandigital numbers in base 10, not the smallest pandigital number for the first 5 bases represented in base 10

  • @bobobo1673
    @bobobo1673 2 ปีที่แล้ว

    Hi, why I see the screen so small?

  • @tobeypeters
    @tobeypeters 2 ปีที่แล้ว +1

    Can you show what a real world use for this language is? It seems too complicated and not for beginners. It also seems like it's stuff that would be in a support library of a real language. I pass in my array and get my output back. Seems like the language has some good ideas in it, to manipulate arrays. So, not hating on APL. Can you manipulate JSON with it? I have a list of dictionaries, I'd like to manipulate more easily?

    • @brunocolombet9829
      @brunocolombet9829 2 ปีที่แล้ว

      I agree with you. It seems a fun tool to play with, then you go back to C++ to do real things. :)

    • @peetiegonzalez1845
      @peetiegonzalez1845 2 ปีที่แล้ว

      Q (with Kdb) is a proprietary extention of J, which is essentially APL in ASCII. It's industry standard for banks and hedge funds doing quant analysis on the markets and making millions trading off the back of them. If you can learn APL, you can learn J, and thus Q, and get a job that pays $$$$$

    • @argonwheatbelly637
      @argonwheatbelly637 8 หลายเดือนก่อน

      I remember working the trading desks with Smalltalk, and some of the people were using APL.

  • @lorenzobolis5166
    @lorenzobolis5166 2 ปีที่แล้ว +3

    I think you misread the first problem: it asks the first 5 pandigitals in base 10, not the first pandigital in each of the first 5 bases (represented in base 10).
    Nevertheless I also like your problem, well done!

  • @vasanthkumar3685
    @vasanthkumar3685 2 ปีที่แล้ว

    Point free means?

    • @tobiasbergkvist4520
      @tobiasbergkvist4520 2 ปีที่แล้ว +1

      For example (Haskell, non-point-free):
      add3 myvariable = 3 + myvariable
      Point free version:
      add3 = 3 +
      Notice that the point free version doesn't require you to name the function arguments (which is what makes it point-free)

    • @BigBeesNase
      @BigBeesNase 2 ปีที่แล้ว +2

      It means making a function declaration less readable.

  • @tesla8551
    @tesla8551 2 ปีที่แล้ว +1

    Can APL use complex types as input and not just numbers or chars? This is very limiting for a real life problem and away from academic use! Can it handle json efficiently? Can it be packed into a dll or .so file so I can call it from other languages? This are the most important questions for me, other than that APL is just a cool toy!

  • @gtgunar
    @gtgunar 2 ปีที่แล้ว

    Spell out iota, tally and such, in text...

  • @darthmoomoo
    @darthmoomoo 2 ปีที่แล้ว +2

    I have no idea why TH-cam recommended this to me. Why is this guy coding in wingdings?

    • @BigBeesNase
      @BigBeesNase 2 ปีที่แล้ว +2

      He is obsessed.

    • @Kh-ik3de
      @Kh-ik3de วันที่ผ่านมา

      @@BigBeesNaseit’s not Wingdings but it may as well be