IRC channel logs

2020-04-11.log

back to list of logs

<str1ngs>Aurora_iz_kosmos: how trivial is this? I did write a way to evaluate guile scheme from go. https://github.com/mrosset/scheme
<Aurora_iz_kosmos>str1ngs: Was that in answer to my query? It's not quite what I meant. I mean more to interact with a service written in Go from Guile.
<Aurora_iz_kosmos>xmlrpc-like
<str1ngs>Aurora_iz_kosmos: I would use json rpc over xmlrpc. something like https://golang.org/pkg/net/rpc/
<str1ngs> https://golang.org/pkg/net/rpc/jsonrpc/ to be precise.
<Aurora_iz_kosmos>Fair, I'd probably have looked for JSON first as I find it more pleasant to read.
<Aurora_iz_kosmos>Eh, that's part of the standard library?
<Aurora_iz_kosmos>Neat.
<str1ngs>but I'm not sure how you would handle the RPC on guile side. you could maybe start with a UNIX socket.
<Aurora_iz_kosmos>Hm, good question that yeah.
<str1ngs>I had hoped to created a dbus service eventually do hand proper guile RPC. but my project is not at that stage yet.
<str1ngs>eval and read would work, but the security implications of that..
<Aurora_iz_kosmos>You could have that as a mode, or otherwise using RPC handlers for specific calls.
<Aurora_iz_kosmos>Discarding anything invalid.
<Aurora_iz_kosmos>One could use GOOPS for handlers or not. Depends on how you feel like.
<str1ngs>Aurora_iz_kosmos: it's doable, be interesting to see what you come up with :)
<Aurora_iz_kosmos>I'd probably use GOOPS anyway and explicitly register handlers. For simplicity's sake.
***drakonis1 is now known as drakonis
<rlb>wingo: the "News" link at the bottom of the main page links to very old news: https://www.gnu.org/software/guile/
<rlb>(i.e. on savannah circa 2016)
<rlb> https://savannah.gnu.org/news/?group=guile
<rlb>And until you said it, I hadn't noticed 3.0.2 :)
*rlb might attempt that this weekend -- we'll see.
<dsmith>Building without the bootstraped .go files and without the jit is so tedious.
<rlb>noooooooo doubt :)
<rlb>cf. the buildd times, though I'm sure you can sympathize: https://buildd.debian.org/status/package.php?p=guile-3.0 (the "all" links there on the right).
<rlb>e.g. https://buildd.debian.org/status/logs.php?pkg=guile-3.0&ver=3.0.1%2B1-1&arch=armel
<dsmith>9 hours
<dsmith>Ugh
<dsmith>Takes like 6 minutes to cross-compile on my 8core work laptop
<rlb>Nice, though I suspect the ftp-masters would frown on such an approach for the debs :)
<dsmith>Yes. And you must have all the deps available too.
<rlb>I have thought about arranging an arch-specific deb (for one of the faster archs) that just contains the .go files, and then having the others depend on that, but that kind of indirect arch dependency is (unsurprisingly) not favored, and I think may have caveats.
<dsmith>Yeah, it's not just the alignment.
<dsmith>=> 0x73ba24d8: 04 f0 1f e5 ; <UNDEFINED> instruction: 0xf004e51f
<daviid>lloda: hello! I am on stable-2.2, git clean -dxf, git pull, git fetch --all, now, admittedly not a very good git user, what is the easier way to apply your wp-exception-truncate patch? tx
<daviid>lloda: I mean can I just merge those, are they (still) compatible with the stable-2.2 branch?
<daviid>I don't thnk that would work, there are quite a lot more patches there then just exception-truncate, not sure others were made for 2.2
<daviid>cherry-pick doesn't work either
<retropikzel>How can I get the body out of (http-get "url") response?
<str1ngs>retropikzel: I use http-request to get a body. http://paste.debian.net/1139665
<str1ngs>copy-to-port is custom . you can use any port function
<retropikzel>Thank you
<str1ngs>retropikzel: the tricky bit is receive if you have not used values before. but once you get use to the they are nice.
***wxie1 is now known as wxie
<lloda>hi daviid, wip-exception-truncate is rebased on master since that's what I use
<lloda>but I have pushed a patch to branch stable-2.2-wip-exception-truncate which goes on top of 2.2
<lloda>since I don't use 2.2 I haven't tested it, but it should work
<lloda>lmk
<guix-vits>Hi there.
<dsmith>Hey hey
<RhodiumToad>bleh. accessing a bytevector as big-endian u16 is tons slower than as native-endian u16
<dsmith>Getting closer...
<mwette>dsmith: lost track ... doing all non-thumb ?
<dsmith>mwette: I think so.
<dsmith>The BLX <immediate> must be to 4 byte alignment. Actually, the branch offset must be aligned.
<dsmith>Sometimes, there is a 2 byte alignment.
<dsmith>Aligning the BLX op fixed almost all cases.
<dsmith>But I'm still getting one somewhere. Almost looks like it's not the JIT code making it.
<dsmith>mwette: I'm on Raspbian. Whatever that is. Thought it would be thumb, but I'm getting the errors.
<mwette>I read this: https://www.embedded.com/introduction-to-arm-thumb
<dsmith> https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf
<dsmith>Page 235
<dsmith>But specifically page 348
<mwette>thanks -- was looking for that
<dsmith>The T2 encoding
<dsmith>Here is my current illegal instuction: 0x73ba24d8: 04 f0 1f e5
<dsmith>Which is T2: 0xF004 0xE51F
<dsmith>That bit 0 is not valid.
<dsmith>"H == ‘1’ then UNDEFINED"
<mwette>illegal in both modes (ARM and THUMB)?
<dsmith>Right
<dsmith>The 0xF0 at the start makes it a thumb
<dsmith>Here's the thing. I'm logging *every* BLX that gets generated (calli in arm-cpu.c)
<dsmith>And the failing one is not logged.
<mwette>what about BX?
<dsmith>So either something else is making it, or it's some other code that corrupting it.
<dsmith>That not a 32bit thumb code. Is 16 bit
<mwette>ah
<dsmith>There are only 4 immediate jump type 32bit codes. Bcond, B, BLX, BL.
<dsmith>It's either a bad offset for a BLX, or a BL or B got corrupted into a BLX.
<marmulak>hey buddies
<mwette>o/
*RhodiumToad further improves the performance of hex->bin
<marmulak>that's great!
<marmulak>ok so I have a noob question of the day
<marmulak>what are we supposed to use the char-set type for? Because there is also 'string', and I was trying to write another example program yesterday that I imagined char-set might be useful for and then ended up hacking the whole thing together with strings only
<RhodiumToad>char-set is useful for a lot of things, e.g. looking for delimiters
<dsmith>marmulak: A char set is like [a-z] patter in regular expressions.
<dsmith>A set of char to match
<RhodiumToad>or scanning input for tokens
<marmulak>isn't a string basically a set of chars ~_^
<RhodiumToad>a string is a vector of chars
<marmulak>so the different types simpl have different functions associated with them?
<RhodiumToad>a char-set is an _unordered_ set of characters
<marmulak>ioh I see
<dsmith>And no duplicates.
<marmulak>oh ok that's useful info
<dsmith>"heloooo" would not be a set
<marmulak>I imagine this helps with functions and optimization
<marmulak>my other newbie question is, let's say I (read) input, and the input is a word like "cat" except it's not in quotes. What I gathered so far playing with guile is that if it's in quotes its type is string
<marmulak>but without quotes I couldn't figure out its type
<mwette>marmulak: char-set's provide a general way to predicates like char-numeric?
<dsmith>(read) returns a "datum". An s-expression.
<mwette>s/way to predicates/way to generate predicates/
<RhodiumToad>marmulak: if you're reading it with (read), then a word not in quotes is a symbol
<dsmith>Well, *reads* the next one and returns it.
<marmulak>RhodiumToad: a symbol is meant to be evaluated, right?
<RhodiumToad>whether to evaluate it after reading it is up to you
<marmulak>hmm gotcha
<dsmith>scheme@(guile-user)> (read)
<dsmith>(this is a test)
<dsmith>$1 = (this is a test)
<dsmith>scheme@(guile-user)> (read)
<dsmith>(
<dsmith>another
<dsmith>test
<dsmith>)
<dsmith>$2 = (another test)
<RhodiumToad>and given those, for example (symbol? (car $1)) will be #t
<dsmith>scheme@(guile-user)> (read)
<dsmith>"
<dsmith>strings
<dsmith>too
<dsmith>"
<dsmith>$3 = "\nstrings\ntoo\n"
<RhodiumToad>paste sites are a thing that exist
<marmulak>I know there's a lot of books and materials about scheme listed online, but do you guys know any particular book that introduces readers to these concepts for the first time like predicates and lambdas, folding, etc? Like, ELI5
<dsmith>RhodiumToad: Yes. Sorry. Thought it would be small enough..
*dsmith goes back to banging his head against the desk
<marmulak>hehe
<rekado>marmulak: The Little Schemer builds up your understanding from the ground up.
<rekado>it’s deceptively simple and sometimes annoyingly thorough.
<marmulak>I'm OK with simple
<marmulak>I have programming experience but I don't feel that I'm an experienced programmer. And I think from a compsci point of view I should strengthen my conceptual foundations
<rekado>The Little Schemer tries to develop your intuition of Scheme.
<rekado>It sometimes takes a little long before it will move on to other things
<marmulak>sounds good
<rekado>and sometimes the question/answer format seems to get in the way, but generally I think it’s a very good start.
<rekado>you start from a handful of primitives and build your way up
<rekado>by the end you should be very comfortable with lambda and what can be done with it.
<marmulak>great
<marmulak>would you say, that scheme is a "powerful" language?
<RhodiumToad>depends what you mean by that
<marmulak>I'm also curious
<marmulak>about your opinions
<dsmith>marmulak: In Paul Graham speak, I'd say yes. (he talks about laguage power in his writings)
<marmulak>a few days ago I joked in #guix that they should use haskell instead of scheme (part of the joke is implying they didn't have to fork nix). Maybe there is a technical reason to prefer scheme as a language, and some people responded with that type of answer. Their statements gave me the impression they considered scheme's strength to be related to some idea like power, completeness, or maybe flexibility
<marmulak>not that I'm searching for technical definitions of these terms, but it'd help to know what proponents of scheme think is good about scheme
<marmulak>and if there is something that makes scheme special, if there are other languages that also share that quality, whether in whole or in part
<dsmith>It's functional when you need it, or imperative when you need it, or OO when you want that.
<civodul>marmulak: the answer to this kind of question is always half-technical, half-social
<civodul>for the technical bit, see e.g., https://hal.inria.fr/hal-00824004/en
<civodul>& https://hal.inria.fr/hal-01580582/en
<civodul>(shameless plug, but hopefully gives some insight!)
<rekado>I used to be a Haskeller, actually, but I always liked Scheme. (Nowadays I no longer write Haskell.)
<marmulak>I'll gladly read stuff
<marmulak>dsmith: so it is multi-paradigm
<marmulak>I have read this also about ML languages like ocaml
<rekado>in my opinion, Haskell is lovely, but kinda inflexible at times, leading to lots of type-directed churn during development
<rekado>sometimes I do miss compile-time type checking in Scheme
<marmulak>scheme encounters type errors only at runtime?
<rekado>there are alternatives to using the type system as the only compile time checks, though, such as enums etc.
<rekado>procedures don’t have a type signature which would be checked by the compiler
<rekado>there’s Typed Racket which has type signatures
<rekado>and there are contracts, which serve a similar purpose.
<marmulak>so far I'm finding scheme fun and easy (well as easy as an unfamiliar language can be). But at this stage in my learning I find myself writing the same imperative programs I used to in C
<marmulak>racket seems kind of popular, though I never heard of it until recently
<rekado>becoming familiar with map and fold and friends will likely change your style.
<rekado>I’m now approaching most problems as some sort of data transformation
<marmulak>I used map a little bit while trying to learn haskell. I felt its great utility but understood very poorly how it works
<rekado>this makes me write small procedures that take an input in one format and return the input in a new format.
<dsmith>When I started learning Haskell, I was delighted that my old frinds from Scheme where there (map, fold, ...)
<rekado>map applies a procedure to all elements of a list and returns a new list.
<dsmith>Some had differnt names.
<marmulak>rekado: hmm yes
<rekado>fold is used to build up a data structure by processing a list item by item
<marmulak>it makes me think of folding@home
<rekado>heh
<RhodiumToad>if you really want to tie your brain into knots, try shift/reset
<marmulak>T.T
<rekado>you use fold by defining a procedure that is called for every element of the list; the procedure takes the element and the intermediate return value up to this point.
<rekado>this allows you to compute sums, count elements, filter lists, etc
<rekado>fold is very versatile and it becomes easy once you recast your problems as data transformations.
<rekado>gotta go
<marmulak>thanks
<dsmith>Hah!
<dsmith>My "fix" for veneers is "ldr pc,[pc,#-4]" Which is *exactly* the same thing as the malformed BLX!
<dsmith>Progress!
<RhodiumToad>hm, is it exactly the same?
<marmulak>do car and cdr stand for anything in English?
<RhodiumToad>yes
<marmulak>sure not car like the car I drive
<RhodiumToad> http://www-formal.stanford.edu/jmc/history/lisp/node2.html
<RhodiumToad>the names come from assembler macros on the IBM 704
<marmulak>:o
<marmulak>this explains car and cdr, but it also mentions cpr and ctr
<RhodiumToad>the car and cdr account for 30 bits of the 36-bit word, those other two were the remaining two 3-bit fields
<RhodiumToad>which never became exposed at the programming level in the same way that car and cdr did
<marmulak>I see
<marmulak>lisp doesn't have cpr, ctr?
<RhodiumToad>nope
<marmulak>I see
<marmulak>shit, I would have understood the docks better if car and cdr were named something like head and tail
<RhodiumToad>some dialects of lisp allow you to call them that.
<RhodiumToad>but the original names have proven hard to stamp out
<marmulak>it's all good
<marmulak>once you know you can't un-know
<RhodiumToad>of course then there's things like (caddr x)
<RhodiumToad>which is just a shorthand for (car (cdr (cdr x)))
<marmulak>damn
<RhodiumToad>often considered bad style, though
<marmulak>is that the 3rd element of a list?
<RhodiumToad>it is indeed
<marmulak>OK I sort of see where that is going
<RhodiumToad>something like (cadar x) is a bit more complicated
<RhodiumToad>that's the second element of a list which is the first element of x
<marmulak>a list within a list
<RhodiumToad>i.e. (cadar '((1 2) 3)) is 2
<marmulak>can you show me what a pair looks like
<RhodiumToad>you can write a pair as (x . y)
<RhodiumToad>so (car '(x . y)) is x and (cdr '(x . y)) is y
<RhodiumToad>a list like (1 2 3) is actually (1 . (2 . (3 . ())))
<marmulak>do there have to be spaces around the period
<marmulak>so for pairs we also use car/cdr to get the first and second element
<RhodiumToad>in most cases without spaces the . would be part of the adjacent value, unless there was some delimiter like a )
<marmulak>ah I see
<marmulak>x.y becomes a symbol
<RhodiumToad>car and cdr are specifically for dealing with pairs. a list is made up of pairs
<marmulak>I see, I understood it kind of backwards
<marmulak>so a list is like a matryoshka
<RhodiumToad>a list is either the special value () which is an empty list, or it's a pair whose cdr is a list
<RhodiumToad>so if you follow the cdr's, you end up at a ()
<marmulak>so (1) = (1 . ())
<RhodiumToad>you can make s-expressions that are "improper lists", where the chain of cdrs ends in some atom other than ()
<marmulak>that sounds wrong
<RhodiumToad>e.g. formal parameter specifications are improper lists, like (lambda (a b . c) ...)
<RhodiumToad>c in that example is a "rest arg", it's assigned a (possibly empty) list of all parameters after the second
<marmulak>thanks
<marmulak>I'm reading The Little Schemer
<RhodiumToad>I haven't read that
<RhodiumToad>lisp was about the 4th programming language I learned as a kid, maybe 14 or so
<marmulak>it defines a function atom? that returns #t if (if I understood it) the input is not pair or null. I entered its definition into guile and it appears to be working as the book provided it
<marmulak>but I suspected this function does what symbol? does in guile
<marmulak>as far as I tested the results appear to be the same
<RhodiumToad>try it with something that's not a symbol
<RhodiumToad>e.g. (atom? 1) would be true, but (symbol? 1) would not
<manumanumanu>marmulak: you can define the function atom to be true if something is not a pair or null if you want
<RhodiumToad>manumanumanu: I got some more performance for hex->bin by simplifying that sparse array thing
<manumanumanu>RhodiumToad: great! And I made your bin->hex a bit faster :D
<RhodiumToad> https://github.com/RhodiumToad/scheme-bits/blob/master/hex/hex.scm
<RhodiumToad>how?
<manumanumanu>It is sooo little. Stable at about 2% difference by just porting your bin->hex stuff to my old implementation.
<manumanumanu>RhodiumToad: but looking at the code, there should be no difference. You bind an extra variable for the loop check through your macro, but that should be inlined
<RhodiumToad>yeah, the binding isn't really necessary in this usage, it's just that numeric-for is written for general use
<manumanumanu>I have a more or less feature complete implementation of racket's for loops btw
<manumanumanu>if you are interested
<manumanumanu>that produces optimal code in all cases I have found
<manumanumanu>RhodiumToad: https://hg.sr.ht/~bjoli/guile-for-loops
<RhodiumToad>I don't really like complex looping macros.
<manumanumanu>I use it mostly for repl stuff where named lets quickly become unwieldy
<manumanumanu>It is not as powerful as foof-loop, but has (imho) a simpler syntax.
<manumanumanu>but I don't know whether foof loop can do a lazy right fold, which my for loops can
<RhodiumToad>one thing I tried was exploiting the fact that guile allows uniform-vector ops on bytevectors. but that actually made it slower
<RhodiumToad>i.e. using u16vector-ref etc.
<RhodiumToad>that saves all the uses of 2*, but somehow it ended up slower overall
<manumanumanu>RhodiumToad: guile does a lot of unboxing magic with bytevectors iirc, which might be it
<manumanumanu>at least with floats
<manumanumanu>RhodiumToad: do you have any changes coming, or would you mind a patch for supporting upper/lower case and delimiters?
<RhodiumToad>I don't have any immediate changes planned
<manumanumanu>anyway, my bin->hex for some reason is 2-4% faster. I don't understand why. Check it out. Take it if you want: https://hg.sr.ht/~bjoli/misc/browse/default/hex.scm
<manumanumanu>(under guile3)
<RhodiumToad>I may look at that sometime, not now
<manumanumanu>Anyway, thanks for the code golfing. I had fun
<manumanumanu>good night!
***rlb is now known as rbl
***rbl is now known as rlb
<rlb>With the provided GUILE_PKG automakery and given say GUILE_PKG([3.0 2.2]) in configure.ac, is there an easy way to pick 2.2 for a given configure invocation when both are available, i.e. something like ./configure --with-guile=guile-2.2?
<rlb>(Use case is building a tree twice to test both flavors.)
<mwette>maybe ./configure GUILE=guile-2.2
<rlb>...looking at aclocal.m4 seems like maybe not, unless I were to create my own "shadow" PKG_CONFIG_PATH/LIBDIR or similar that didn't have 3.0. But for now I may be able to just not use GUILE_PKG and instead do the important bits of what it does directly.
<mwette>how about ./configure GUILE_EFFECTIVE_VERSION=2.2
<mwette>I'm looking in guile.m4
<rlb>mwette: yep, brilliant. Looks like that may work. Thanks.
<rlb>New 2.2 and 3.0 debs have been uploaded that are intended to allow multiple guile-X.Y-dev packages to be installed at the same time (hence the questions I was asking).
<rlb>(just to unstable)
<civodul>congrats, rlb!
<manumanumanu>rlb: does that mean guile-3 is coming to a debian-based distro near me?
<rlb>Should be -- I finally got it to build on all the release architectures, and it's been in unstable for a bit: https://packages.debian.org/sid/guile-3.0 Hasn't migrated to testing yet, though.
<manumanumanu>rlb: hooray. Thanks! Saw this as well: https://packages.ubuntu.com/focal/guile-3.0
<manumanumanu>which is great, since I just got a new linux server. 6 cores ready to build! I don't have to do stuff on my odroid-xu4 anymore :D
<rlb>nice
<manumanumanu>then I can just update ubuntu on that one and have an official package